<?php

namespace App\Services;

use App\Models\Idcnode;
use Slowlyo\OwlAdmin\Services\AdminService;

/**
 * IDC机房管理
 *
 * @method Idcnode getModel()
 * @method Idcnode|\Illuminate\Database\Query\Builder query()
 */
class IdcnodeService extends AdminService
{
	protected string $modelName = Idcnode::class;

	public function listQuery()
	{
		$model = $this->getModel();
		return $this->query()->with('operator')->orderByDesc($model->getUpdatedAtColumn());
	}

	public function getData($idc_belong)
	{
		if ($idc_belong) {
			// 这里需要改为模糊查询
			// return $this->query()->where('idc_belong', 'like', '%'.$idc_belong.'%')->get();
			return $this->query()->get();
		}else{
			return $this->query()->get();
		}
	}
}